<template>
  <card-container @refresh="refresh" :title="title">
    <el-table class="stat-table" @sort-change="handleSortChange" height="100%" :data="statisticsData">
      <el-table-column sortable="custom" label="企业名称" align="left" prop="enterpriseName">
        <template slot-scope="scope">
          <span class="blue-font">{{ scope.row.enterpriseName }}</span>
        </template>
      </el-table-column>
      <el-table-column sortable="custom" label="隐患数量" align="center" prop="questionCount"/>
      <el-table-column sortable="custom" label="整改完成数" align="center" prop="zgwc"/>
      <el-table-column sortable="custom" label="完成率" align="center" prop="repairRate">
        <template slot-scope="scope">
          <el-tag :type="getType(scope.row.repairRate)">{{ scope.row.repairRate }}</el-tag>

        </template>
      </el-table-column>
    </el-table>
  </card-container>
</template>

<script>
import {statisticsPageMixins} from "@/views/checkStatisticsPage/mixins/statisticsPageMixins";
import {statisticRank} from "@/api/checkPage/statistics";

export default {
  mixins: [statisticsPageMixins],
  data() {
    return {
      title: '整改情况排行',
      queryFun: statisticRank,
      statisticsData: []
    }
  },
  methods: {
    getType(value) {
      value = parseInt(value)
      if (value > 80) {
        return 'success'
      }
      if (value > 50) {
        return 'warning'
      }
      return 'error'
    },
    changeRowData(baseData) {
      return baseData
    }
  }
}
</script>

<style scoped>

</style>
